package com.nlx.notes.module.mapper;

import com.nlx.notes.module.entity.FlowDayStatistics;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

/**
 * <p>
 *  Mapper 接口
 * </p>
 *
 * @author nlx
 * @since 2024-12-15
 */
public interface FlowDayStatisticsMapper extends BaseMapper<FlowDayStatistics> {


    @Update(" update flow_day_statistics set expense = expense +#{amount} where id = #{id}")
    void incDayExpenseAmount(@Param("id") Long id, @Param("amount") int amount);

    @Update(" update flow_day_statistics set income = income +#{amount} where id = #{id}")
    void incDayIncomeAmount(@Param("id") Long id, @Param("amount") int amount);


    @Update(" update flow_day_statistics set day_amount = day_amount  - #{amount} where id = #{id}")
    void decDayAmount(@Param("id") Long id, @Param("amount") int amount);
}
